package cn.ibizlab.todo.core.extensions.service;

import cn.ibizlab.todo.core.pms.client.TaskFeignClient;
import cn.ibizlab.todo.core.pms.service.impl.TaskServiceImpl;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.todo.core.pms.domain.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;

/**
 * 实体[任务] 自定义服务对象
 */
@Slf4j
@Primary
@Service("TaskExService")
public class TaskExService extends TaskServiceImpl {

    @Autowired
    TaskFeignClient taskFeignClient;

    /**
     * 自定义行为[UpdateDeadline]用户扩展
     * @param et
     * @return
     */
    @Override
    @Transactional
    public Task updateDeadline(Task et) {
        Task et2 = new Task();
        et2.setDeadline(et.getDeadline());
        return taskFeignClient.otherUpdate(et.getId(), et2);
    }
    /**
     * 自定义行为[UpdateDesc]用户扩展
     * @param et
     * @return
     */
    @Override
    @Transactional
    public Task updateDesc(Task et) {
        Task et2 = new Task();
        et2.setDesc(et.getDesc());
        return taskFeignClient.otherUpdate(et.getId(), et2);
    }
    /**
     * 自定义行为[UpdateName]用户扩展
     * @param et
     * @return
     */
    @Override
    @Transactional
    public Task updateName(Task et) {
        Task et2 = new Task();
        et2.setName(et.getName());
        return taskFeignClient.otherUpdate(et.getId(), et2);
    }
    /**
     * 自定义行为[UpdatePri]用户扩展
     * @param et
     * @return
     */
    @Override
    @Transactional
    public Task updatePri(Task et) {
        Task et2 = new Task();
        et2.setPri(et.getPri());
        return taskFeignClient.otherUpdate(et.getId(), et2);
    }
    /**
     * 自定义行为[UpdateType]用户扩展
     * @param et
     * @return
     */
    @Override
    @Transactional
    public Task updateType(Task et) {
        Task et2 = new Task();
        et2.setType(et.getType());
        return taskFeignClient.otherUpdate(et.getId(), et2);
    }
}

